home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
os2
/
srefv12i.zip
/
install.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-03-27
|
58KB
|
1,762 lines
/* this is the SRE-FILTER installation program */
/* Load up advanced REXX functions */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
initfilt_file=''
copyall=0
echo off
/* --- Load the tcp/ip function library, if necessary --- */
if RxFuncQuery("SockLoadFuncs")=1 then do /* not there */
call RxFuncAdd "SockLoadFuncs","rxSock","SockLoadFuncs"
call SockLoadFuncs
end
thishost=' '
parse version atype .
if atype<>"REXXSAA" then do
say " WARNING: SRE-Filter ver 1.2i is designed to work under Classic Rexx "
say " In particular, it does NOT work under Object Rexx. "
say " Other versions of REXX, such as Quercus's REXX, have not been tested."
say " Note: You are using REXX version: " atype
say " (hit ENTER to continue) "
pull .
end /* Do */
dropunz=0 ;
foo=rxfuncquery('UZLoadFuncs') /* load UNZIP dll */
if foo=1 then do
dropunz=1
call RxFuncAdd 'UZLoadFuncs', 'UNZIPAPI', 'UZLoadFuncs'
call UZLoadFuncs
end
foo=rxfuncquery('UZLoadFuncs')
gotunz=1
if foo=1 then do
say " Can not find UNZIP procedure library: UNZIPAPI.DLL"
say " Did you download it? "
say " (hit ENTER to continue)"
parse pull gunk
gotunz=0 ; dropunz=0
end /* Do */
/*---- load the rexxlib library */
droprxlib=0 ; gotrxlib=1
foo=rxfuncquery('rexxlibregister')
if foo=1 then do
droprxlib=1 ; gotrxlib=0
call rxfuncadd 'rexxlibregister','rexxlib', 'rexxlibregister'
call rexxlibregister
end
foo=rxfuncquery('rexxlibregister')
if foo=1 then do
say " Could not find the REXXLIB procedure library (REXXLIB.DLL). "
say " Did you download it? "
exit
end /* Do */
ansion=checkansi()
if ansion=1 then do
aesc='1B'x
cy_ye=aesc||'[37;46;m'
normal=aesc||'[0;m'
bold=aesc||'[1;m'
re_wh=aesc||'[31;47;m'
reverse=aesc||'[7;m'
end
else do
say " Warning: Could not detect ANSI.... Install will look ugly ! "
cy_ye="" ; normal="" ; bold="" ;re_wh="" ;
reverse=""
end /* Do */
cls
say " " ; say
call lineout, bold cy_ye
call lineout, "This is the SRE-FILTER (v 1.2i) installation program (2/97)."
call lineout, "... an HTTP filter for the GoServe OS/2 Internet Server "
call lineout, normal
say " This program will ask for the names of a few directories,"
say " and will copy a number of files to these directories."
say " "
if yesno(" Are you ready to continue ")=1 then
nop
else do
say " See you later?.. "
exit
end
/* defaults */
datadir="your GoServe Data-directory"
workdir="your GoServe Working-directory"
helpdir='the SAMPLES/ subdirectory of the GoServe Data-directory'
useindex=' '
if yesno(" Install (I), or review the installation notes (R)",,'I R')=0 then do
say " okay, reviewing installation notes. ... "
say ' '
signal gonotes
end
/* check status of goserver and macrospace routines */
a=dospidlist(l1,l2)
do mm=1 to a
foo=upper(strip(filespec('n',l2.mm)))
if foo='GOSERVE.EXE' then do
say bold " GOSERVE appears to be running " normal
say " Please shut down GOSERVE before you (re) install SRE-Filter! "
exit
end /* Do */
end /* do */
nosref0=1
signal on syntax name nosref
filter_name=sref_version() /* if not here, then skip to nosref */
nosref0=0
nosref: /* if skipped here, then load .rxl */
signal off syntax
if nosref0=0 then do
say " "
say bold "A prior version of the SRE-Filter macrospace procedures " normal " was detected."
say " We recommend clearing macrospace before you install SRE-Filter."
say " However, this might adversely impact other programs (that may also "
say " use REXX's macrospace). "
ok=yesno(" Clear macrospace now (Y) ?")
if ok=1 then do
say " .... clearing macrospace "
foo=macroclear()
say " "
end /* Do */
else do
say " "
say bold " Macrospace will not be cleared. " normal
say " When you are ready to run GOSERVE with SRE-Filter, we recommend "
say " that you first reboot your server (otherwise SRE-Filter will,"
say " inappropriately, attempt to use the old procedure library)."
say " "
end /* Do */
end /* Do */
install_all=yesno(" Full installation (F), or just upgrade executables (U)",,'F U')
if install_all=0 then do
say " Parameters will NOT be modified (you might want to read the upgraders notes) "
end
if install_all=0 then signal skip
say " First,what is your IP address (it will be given OWNERS status)"
ipaddr=" "
thishost=get_hostname()
sagain:
call charout , BOLD "What is your IP address (ENTER="thishost "):? " normal
pull youraddr
if youraddr=' ' then youraddr=thishost
parse var youraddr t1 '.' .
isnum=0
if datatype(t1)='NUM' then
isnum=1
say " wait while that address is checked ... "
chk=host(youraddr)
if translate(word(chk,2))<>"IS" & word(chk,2)<>"=" then do
call lineout,re_wh " Unable to find address: " youraddr normal
say " OWNER variable not assigned (but you can assign it later)"
ipaddr=" "
end /* Do */
else do
if isnum then
ipaddr=word(chk,1)
else
ipaddr=word(chk,3)
say " Your IP address: " ipaddr
end
skip:
nowdir=directory()
adir=filespec("drive",nowdir)
defname=adir||'\GOSERVE'
defname2=adir||'\WWW'
skip:
/* -------- Working directory (must exist ) */
say
call lineout, cy_ye " Please enter a few directory names: " normal
say " "
call lineout, bold " What is GOSERVE's "working" directory? " normal
say " * The SRE-FILTER program files will be written there. "
say " * This does "bold"not"normal" have to be the directory that contains GOSERVE.EXE"
n1:
godir=get_dir(defname)
if godir=" " then godir=defname
if godir="n.a." then signal n1
godir=strip(godir,'t','\')
gsname=godir||"\GOSERVE.EXE"
call sysfiletree gsname,gname2,'F'
if gname2.0=0 then do
say " Could not find GOSERVE.EXE in " godir "...."
if yesno(" Are you sure you want to use this directory?")=1 then signal useit0
if godir=defname then defname= "n.a."
signal n1
end /* Do */
useit0: workdir=godir
tdir=strip(godir,'t','\')||'\TEMP'
oo=sysmkdir(tdir) /* creating temporary directory */
say " "
/* -- Get the DATA subdirectory of the working directory */
say " "
say " Where should SRE-FILTER's Username, Access, Auditing, etc. files be installed?"
say " .. it is recommended that it be under your working directory ! "
sdatadir=get_dir(workdir||'\DATA')
/* -- Get the MESSAGE subdirectory of the working directory */
say " "
say " Where should SRE-FILTER's Message Boxes be stored?"
say " .. it is recommended that it be under your working directory ! "
mboxdir=get_dir(workdir||'\MESSAGE')
/* -- Get the Mail subdirectory of the working directory */
say " "
say " Where should SRE-FILTER write & read e-mail from?"
say " .. this should be the inbox of your SMTP server (if you are not"
say " running an SMTP server, you can ignore this question)"
mailboxdir=get_dir(workdir||'\MAIL')
/* -- Get the configuration subdirectory of the working directory */
say " "
cfdir:
say " Where should SRE-FILTER's simple-mode configuration files be placed?"
config_dir=get_dir(workdir||'\CONFIGS')
if pos('\SREFCONF',upper(config_dir))>0 then do
say " You can not use the name SREFCONF (it confuses the server) "
signal cfdir
end /* Do */
/* -- Get the UpLOAD subdirectory of the working directory */
say " "
say " Where should SRE-FILTER store Uploaded files?"
upload_dir=get_dir(workdir||'\upload')
/* -- Get the CGI-BIN directory of the working directory */
say " "
say " Where should CGI-BIN files be stored? "
cgibin_dir=get_dir(workdir||'\cgi-bin')
/* -- Get the temporary files of the working directory */
say " "
say " What directory should SRE-Filter use for it's workspace? "
tempdatadir=get_dir(workdir||'\temp')
/* -- Get the data directory */
say " "
call lineout, cy_ye" + + + + "normal BOLD " What is your data directory ?" normal
say ' .. this is the location of your "home page" document. '
datadir=get_dir(defname2)
/* -- Get the IMGS subdirectory of the data directory */
say " "
say " Where should SRE-FILTER's GIF files be installed?"
say " .. it should be under your data directory ! "
gifdir=get_dir(datadir||'\IMGS')
/* -- The "sample and help files" directory */
say " "
say " Where should the Sample and Help Files be installed?"
say bold " We HIGHLY recommend using the default " normal
say " (SRE-Filter's documentation expects it)! "
helpdir=get_dir(datadir||'\SAMPLES',datadir)
/* -- The "temporary directory" -- */
say " "
say " What directory should "bold"SRE-Filter add-ons"normal" use for workspace? "
say " * SRE-Filter will use " tempdatadir " for it's own workspace"
say " * it's recommended, but not required, that this be under "
say " your data directory "
tempdir=get_dir(datadir||'\TEMP')
eek=godir||'\srefiltr.*'
call sysfiletree eek,gname3,'F'
/* -- Done with directory creation -- copy files ... */
/* but first, backup? */
say " "
call lineout, re_wh "Are you re-installing/upgrading SRE-Filter: " normal
call lineout, bold "If you are ... "
foo=yesno(" ... would you like to archive the various user-configurable files")
if foo=1 then do
say " Where should SRE-FILTER archive these files"
aa="\BK"||space(translate(date('o'),' ','/\'),0)
backup_dir=get_dir(workdir||aa)
/* files to backup*/
in_workdir=' SREFILTR.80 SREFQUIK.80 COUNTER.RXX LOGFAIL.HTM ACCFAIL.HTM INITFILT.80 MEDIATYP.RXX '
in_workdir=in_workdir||'PREFILTR.80 POSTFILT.80 POSTRCRD.80 POSTMAIL.80 '
in_sdatadir=' ALL_FILE.CTL ALIASES.IN VIRTUAL.IN USERS.IN SENDFILE.CNT RECRDALL.CNT '
in_sdatadir=in_sdatadir||'COUNTER.CNT SREFLOGS.INI REPSTRGS.IN '
in_mboxdir='ANYONE.LOG '
in_datadir='INDEX.HTM'
call dobackup
say " Note: you might be asked to backup a few other files "
say " (for storage in their 'own' directory)"
end
else do
say " "
end /* Do */
foo=yesno(" SRE-Filter will now be installed. Are you ready? ")
if foo=0 then do
say " Try again later... "
exit
end
say " "
say " Copying dynamic link libraries .. "
if gotrxlib=1 then do
say " Note: a copy of REXXLIB seems to be on your system "
end /* Do */
foo=check_copy('REXXLIB.DLL',workdir)
if dropunz=0 then do
say " Note: a copy of UNZIPAPI seems to be on your system "
end /* Do */
foo=check_copy('UNZIPAPI.DLL',workdir)
say " "
say " Copying SRE-FILTER main and misc. program files files to " workdir
s1=workdir||'\SREFILTR.80'
if stream(s1,'c','query exists')<>' ' then do
say bold "Warning: " normal " An old version of SREFILTR.80 has been detected"
s1a=dostempname(workdir||'\SREFILTR.B??')
ok=yesno(" Would you like to rename it to "|| s1a)
if ok=1 then do
foo=dosrename(s1,s1a)
end
say bold " Note:" normal "SREFILTR.80 contains several 'advanced user' parameters."
say " If you've modified them, you will need to re-do the changes"
say " after this installation is complete. "
say " "
end
s1=workdir||'\SREFQUIK.80'
if stream(s1,'c','query exists')<>' ' then do
say bold "Warning: " normal " An old version of SREFQUIK.80 has been detected"
s1a=dostempname(workdir||'\SREFQUIK.B??')
ok=yesno(" Would you like to rename it to "|| s1a)
if ok=1 then do
foo=dosrename(s1,s1a)
end
say bold " Note:" normal "SREFQUIK.80 contains a few 'advanced user' parameters."
say " If you've modified them, you will need to re-do the changes"
say " after this installation is complete. "
say " "
end
foo=check_copy('*.80' ,workdir,,1)
foo=check_copy('SREFMON.CMD' ,workdir,,1)
foo=check_copy('DO*.CMD' ,workdir,,1)
foo=check_copy('FREEUP.CMD' ,workdir,,1)
foo=check_copy('STATUS.CMD' ,workdir,,1)
foo=check_copy('CONFIG2.CMD' ,workdir,,1)
foo=check_copy('CONFCOLR.CMD' ,workdir,,1)
foo=check_copy('SREFCONF.CMD' ,workdir,,1)
foo=check_copy('ADV_OPTS.CMD' ,workdir,,1)
foo=check_copy('USERCFG.CMD',workdir,,1)
foo=check_copy('ALIASCFG.CMD',workdir,,1)
foo=check_copy('ACCESCFG.CMD',workdir,,1)
foo=check_copy('HTACCFG.CMD',workdir,,1)
foo=check_copy('VIRTCFG.CMD',workdir,,1)
foo=check_copy('TESTURL.CMD',workdir,,1)
if install_all=1 then do
foo=check_copy('LOGFAIL.HTM' ,workdir,' This is your "logon failure response file". Are you sure? ')
foo=check_copy('ACCFAIL.HTM' ,workdir,' This is your "access failure response file". Are you sure?')
end
foo=check_copy('CONFIGUR.HTM' ,datadir,,1)
foo=check_copy('CONFCOLR.HTM' ,datadir,,1)
foo=check_copy('*.RXX',workdir,,1)
if install_all=1 then do
say " "
say " Copying user configurable parameter files to " workdir
foo=check_copy('*.IN', sdatadir,' *** THESE ARE PARAMETER & CONFIGURATION FILES : Are you sure?')
say " "
say " Copying configuration file, for the common-log audit facility, to " workdir
foo=check_copy('SREFLOGS.INI', sdatadir,' *** This is the common-log configuration file: Are you sure?')
say " "
say " Copying access control and audit files to " sdatadir
foo=check_copy('ALL_FILE.CTL',sdatadir,' This is your access control file: Are you sure?')
foo1=check_COPY('ADV_OPTS.CTL',sdatadir,,1)
foo=check_COPY('*.CNT', sdatadir,' These are your "hit-counter" files: Are you sure?')
say " "
say "Copying sample message box file to " mboxdir
foo=check_COPY('ANYONE.LOG', mboxdir,' This is your default "message box": Are you sure?')
say " "
say " Copying sample and help files to " helpdir
foo1=check_COPY('*.HTM',helpdir,,1)
foo1=check_COPY('*.SHT',helpdir,,1)
foo=check_COPY('*.DAT',helpdir,,foo1)
foo=checK_COPY('SAMPMAP.*',helpdir,,foo1)
foo=check_COPY('TESTTABL.TBL',HELPDIR,,foo1)
foo=check_COPY('TESTTABL.DEF',HELPDIR,,foo1)
end
foo=check_copy('*.IDX',sdatadir,,1)
foo=check_copy('*.RXL',workdir,,1)
say " Copying Sample CGI-Bin programs to " cgibin_dir
foo1=check_copy('*.PL',cgibin_dir,,1)
foo=check_copy('XCOUNT.CMD',cgibin_dir,,foo1)
foo=check_copy('JCOUNT.CMD',cgibin_dir,,foo1)
foo=check_copy('TEST-CGI.CMD',cgibin_dir,,foo1)
foo=check_COPY('*.DOC',helpdir,,foo1)
foo=check_COPY('*.FAQ',helpdir,,foo1)
say " "
SAY ' Copying GIF file archive to ' gifdir
foo=check_COPY('GIFS.ZIP',gifdir,,1)
say " Copying simple mode configuration files to " config_dir
foo=check_COPY('CONFIGS.ZIP',config_dir,,1)
if gotunz=0 then do
say " "
say bold " UZUNZIP.DLL could not be found " normal
say " * you will need to unzip GIFS.ZIP (in " gifdir
say ' * you will need to unzip CONFIGS.ZIP (in ' config_dir
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
signal nogotuz
end /* Do */
meis=directory()
signal on error name foobar1
signal on syntax name foobar1
okuz=0
gifis=directory(gifdir)
rc=uzunzip(' -q -o GIFS.ZIP',foos)
agifis=directory(config_dir)
rc=uzunzip(' -q -o CONFIGS.ZIP',foos)
okuz=1
foobar1:
signal off error ;signal off syntax
if okuz=0 then do
say " "
say bold "WARNING: " normal
say " A problem with the UNZIP dll has occurred (can not find UZUNZIP). "
say " You can either: "
say " a) ^C, shutdown, and try again (that seems to work) "
say " b) Complete the installation, and then from an OS/2 prompt: "
say " i) UNZIP GIFS.ZIP (in " gifdir
say " ii) UNZIP CONFIGS.ZIP (in " config_dir
say " I know this is a tedious solution, but it is a very flakey problem!"
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
end /* Do */
meis=directory(meis)
nogotuz: nop
IF INSTALL_ALL=0 then SIGNAL DONE1A
/* --- customize index.htm -- */
say " "
call lineout, cy_ye " ... customizing files ... " normal
say " "
say ' Copying sample home page to ' datadir
thefh=grab_file("INDEX.HT0")
if thefh=0 then do
Say " ERROR : Could not find sample home page "
say " You may need to unzip SREFILTR.ZIP again? "
signal done1
end
parse var helpdir foo (datadir) thesamp
thesamp=strip(translate(thesamp,'/','\'),,'/')
thefh=replacestrg(thefh,'helpdirectory',thesamp,'ALL')
dog=datadir||'\INDEX.HTM'
drop foo1
tmp=sysfiletree(dog,foo1,'F')
ok=1
if foo1.0>0 & copyall=0 then
ok=yesno(" Overwrite "||dog"?")
if ok=1 then do
if foo1.0>0 then do
toydog=dostempname(datadir||'\INDEX.???')
foo=dosrename(dog,toydog)
say bold " Note: "normal " just to be safe, your old INDEX.HTM has been "
say " moved to " toydog
call syssleep(2)
end
aa=stream(dog,'c','open write')
if aa<>'READY:' then do
say " ERROR: could not write " dog
signal done1
end
foo=charout(dog,thefh)
if foo>0 then do
say " ERROR: Problem writing " dog
signal done1
end
aa=stream(dog,'c','close')
useindex='INDEX.HTM'
end
else do
dog2=dostempname(datadir||'\SINDX???.HTM')
foo=charout(dog2,thefh)
if foo=0 then do
say bold " Note: "normal " A sample SRE-Filter home page has been"
say " copied to " dog2
say "It contains links to several useful configuration tools, "
say " as well as links to SRE-Filter demos."
call syssleep(4)
useindex=filespec('n',dog2)
end
end
/* --- customize mediatyp.rxx -- */
say " "
say ' Copying the user defined MIME type file (MEDIATYP.RXX) to ' workdir
thefh=grab_file("MEDIATYP.RX0")
if thefh=0 then do
Say " ERROR : Could not find user-defined MEDIATYPE file"
say " You may need to unzip SREFILTR.ZIP again? "
signal done1
end
dog=workdir||'\MEDIATYP.RXX'
drop foo1
tmp=sysfiletree(dog,foo1,'F')
ok=1
if foo1.0>0 & copyall=0 then do
say " Overwrite " dog " -- your customized MIME types list? "
ok=yesno(" Overwrite "||dog"?")
end
if ok=1 then do
foo=sysfiledelete(dog) /* delete any prior version */
aa=stream(dog,'c','open write')
if aa<>'READY:' then do
say " ERROR: could not write " dog
signal done1
end
foo=charout(dog,thefh)
if foo>0 then do
say " ERROR: Problem writing " dog
signal done1
end
aa=stream(dog,'c','close')
end
/*-- Customize CONFIGx.HTM --- */
say " Modifying simple SRE-FILTER configurator (CONFIG0.HTM) "
thefh=grab_file("CONFIG0.HT0")
if thefh=0 then do
Say " ERROR : Could not find CONFIG0 configurator program. "
say " You may need to unzip SREFILTR.ZIP again? "
signal done1
end
thefh=replacestrg(thefh,'helpdirectory',thesamp,'ALL')
dog=datadir||'\CONFIG0.HTM'
drop foo1
tmp=sysfiletree(dog,foo1,'F')
ok=1
if ok=1 then do
foo=sysfiledelete(dog) /* delete any prior version */
aa=stream(dog,'c','open write')
if aa<>'READY:' then do
say " ERROR: could not write " dog
signal done1
end
foo=charout(dog,thefh)
if foo>0 then do
say " ERROR: Problem writing " dog
signal done1
end
aa=stream(dog,'c','close')
say " "
end
/*-- Customize CONFIG2.HTM --- */
say " Modifying Intermediate SRE-FILTER configurator (CONFIG2.HTM) "
thefh=grab_file("CONFIG2.HT0")
if thefh=0 then do
Say " ERROR : Could not find CONFIG2 configurator program. "
say " You may need to unzip SREFILTR.ZIP again? "
signal done1
end
thefh=replacestrg(thefh,'helpdirectory',thesamp,'ALL')
dog=datadir||'\CONFIG2.HTM'
drop foo1
tmp=sysfiletree(dog,foo1,'F')
ok=1
if ok=1 then do
foo=sysfiledelete(dog) /* delete any prior version */
aa=stream(dog,'c','open write')
if aa<>'READY:' then do
say " ERROR: could not write " dog
signal done1
end
foo=charout(dog,thefh)
if foo>0 then do
say " ERROR: Problem writing " dog
signal done1
end
aa=stream(dog,'c','close')
say " "
end
/*-- Customize CONFIG3.HTM --- */
say " Modifying expert SRE-FILTER configurator (CONFIG3.HTM) "
thefh=grab_file("CONFIG3.HT0")
if thefh=0 then do
Say " ERROR : Could not find CONFIGUR configurator program. "
say " You may need to unzip SREFILTR.ZIP again? "
signal done1
end
thefh=replacestrg(thefh,'helpdirectory',thesamp,'ALL')
dog=datadir||'\CONFIG3.HTM'
drop foo1
tmp=sysfiletree(dog,foo1,'F')
ok=1
if ok=1 then do
foo=sysfiledelete(dog) /* delete any prior version */
aa=stream(dog,'c','open write')
if aa<>'READY:' then do
say " ERROR: could not write " dog
signal done1
end
foo=charout(dog,thefh)
if foo>0 then do
say " ERROR: Problem writing " dog
signal done1
end
aa=stream(dog,'c','close')
say " "
end
/*-- Modifying the INITFILT.80 file -- */
say " "
say " Modifying the INITFILT.80 parameters file "
thefh=grab_file("INITFILT.A80")
if thefh=0 then do
Say " ERROR : Could not find INITFILT.A80 parameters file. "
say " You may need to unzip SREFILTR.ZIP again? "
signal done1
end
thefh=replacestrg(thefh,'workingdirectory',workdir,'ALL')
thefh=replacestrg(thefh,'workingdir',workdir,'ALL')
thefh=replacestrg(thefh,'messageboxdir',mboxdir,'ALL')
thefh=replacestrg(thefh,'mailboxdir',mailboxdir,'ALL')
thefh=replacestrg(thefh,'workingdatadir',sdatadir,'ALL')
thefh=replacestrg(thefh,'temporarydir',tempdir,'ALL')
thefh=replacestrg(thefh,'tempdatadir',tempdatadir,'ALL')
thefh=replacestrg(thefh,'owneraddress',ipaddr,'ALL')
thefh=replacestrg(thefh,'uploaddir',upload_dir,'ALL')
thefh=replacestrg(thefh,'cgibindirectory',cgibin_dir,'ALL')
thefh=replacestrg(thefh,'configuredir',config_dir,'ALL')
/* Set some "common parameters" */
uu=set_params(0)
thefh=replacestrg(thefh,'aautoname',aautoname,'ALL')
thefh=replacestrg(thefh,'adefault',adefault,'ALL')
thefh=replacestrg(thefh,'assishtml',assi,'ALL')
thefh=replacestrg(thefh,'ahomename',ahomename,'ALL')
thefh=replacestrg(thefh,'arealm',arealm,'ALL')
thefh=replacestrg(thefh,'awebmaster',awebmaster,'ALL')
thefh=replacestrg(thefh,'assicache',assicache,'ALL')
thefh=replacestrg(thefh,'ahomedir',ahomedir,'ALL')
dog=workdir||'\INITFILT.80'
initfilt_File=dog
drop foo1
tmp=sysfiletree(dog,foo1,'F')
ok=1
if foo1.0>0 & copyall=0 then do
ok=yesno(" Overwrite "||dog"?")
if ok=1 then do
say dog " is your SRE-Filter configuration file... "
ok=yesno(" are you sure you want to overwrite it?")
end
end
if ok=1 then do
dog2=dostempname(workdir||'\INITFILT.B??')
foo=dosrename(dog,dog2)
say bold "Note: " normal " The old INITFILT.80 file has been moved to " dog2
foo=sysfiledelete(dog) /* delete any prior version */
aa=stream(dog,'c','open write')
if aa<>'READY:' then do
say " ERROR: could not write " dog
signal done1
end
foo=charout(dog,thefh)
if foo>0 then do
say " ERROR: Problem writing " dog
signal done1
end
aa=stream(dog,'c','close')
end
/* -- add entry to users.in file */
foo=add_user(sdatadir)
/*--Deleting old .80 files */
say " "
list80='dosearch.80 status.80 srchindx.80'
do mm=1 to words(list80)
a1=word(list80,mm)
dog=godir||'\'||a1
tmp=sysfiletree(dog,foo1,'F')
if foo1.0>0 then do
ok=yesno(" Delete old (support) file: "||dog"?")
if ok=1 then
foo=sysfiledelete(dog) /* delete any prior version */
end /* do */
end
done1: nop
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
done1A: nop
a=scrclear()
call lineout, bold cy_ye " SRE-FILTER has been installed... " normal
say " "
say ' '
say ' Your web site is now ready to be built! '
say ' (just add documents, images, links, etc...)'
say ' '
say ' Notes:'
say ' * 'useindex ', the sample SRE-Filter home page, contains a number of '
say ' useful links to configuration tools, demos, and on-line documentation.'
say " It's located in your GoServe data directory ("datadir")"
say ' * If you use a different File name as your "home page",'
say " be sure to change SRE-FILTER's " bold "DEFAULT " normal " initialization parameter."
say ' '
signal on syntax name gogo
signal on error name gogo
gonotes:
say " "
say bold " Would you like to read some additional configuration hints? "normal
say " "bold"1"normal") Setting up GoServe "
say " "bold"2"normal") Configuring SRE-Filter "
say " "bold"3"normal") Finding Help on SRE-Filter "
say " "bold"4"normal") A note on ports "
say " "bold"5"normal") A note on SRE-Filter add-ons "
say " "bold"6"normal") Notes for Upgraders -- and an INITFILT.80 comparator!"
say " "bold"7"normal") Cleaning up and removing SRE-Filter "
say " "bold"8"normal") View SRE-Filter status information"
say " "bold"X"normal") Exit installation program ."
gonotes2:
call charout, reverse " Select an option from the above: " normal
pull anopt
select
when anopt="1" then signal note1
when anopt="2" then signal note2
when anopt="3" then signal note3
when anopt="4" then signal note4
when anopt="5" then signal note5
when anopt="6" then signal note6
when anopt="7" then signal note7
when anopt="8" then signal note8
when anopt="X" then do
if dropunz=1 then foo=zdropfunc()
if droprxlib=1 then foo=rexxlibderegister()
say " bye .. "
exit
end
otherwise
signal gonotes2
end /* select */
gogo:
signal off syntax
exit
note1: nop
say cy_ye " ----- Configuring GoServe:" normal
say " 1) Instruct GoServe that SREFILTR.80 is the working filter. To do this: "
say ' enter ' bold 'http filter srefiltr.80' normal ' in the'
say " " bold " optional parameters line " normal " in GoServe's settings window,"
say " (right-mouse click on the GoServe icon ...) "
say bold " Option:" normal " You might want to use SREFQUIK.80 instead of SREFILTR.80. "
say " (see the documentation for a discussion of these two variants)."
say " 2) Make sure that GoServe knows your data directory "
say " (use the OPTIONS-DataDir tab in the GoServe status window) "
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
a= scrclear()
signal gonotes
note2:
say cy_ye " ----- Configuring SRE-Filter:" normal
if thishost="" then thishost=get_hostname()
say ' To further configure SRE-FILTER, you can run CONFIGUR.HTM '
say " (actually, you should probably read the documentation first!) "
say " "
say " To do this: "
say " a) Fire up your favorite web browser"
say ' b) Point it a http://'thishost'/CONFIGUR.HTM'
say ' (Note: you can also use /CONFIGURE, which is "aliased" to CONFIGUR.HTM)'
say ' c) You can then choose one of three configuration modes:'
say ' i) Simple mode: A well-documented, form based tool for modifying '
say ' the more important SRE-Filter parameters'
say ' ii) Intermediate mode: A less well-documented, but more powerful, '
say ' form based tool for modifying almost all of the parameters '
say ' iii) Expert mode: Edit the various text files containing the '
say ' the parameters'
say 'Note that 'bold'parameters'normal' include:'
say ' usernames, redirection aliases, SEL-specific access controls, '
say ' virtual directories, and HTACCESS files.'
say ' '
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
say bold " A Note on Security: " normal
say " SRE-Filter checks for SUPERUSER privileges before allowing access to "
say " the configurator. Note that the OWNER address (that you entered at the "
say " beginning of this installation), and the user you (may) have added"
say " are both granted SUPERUSER status. "
say " "
say " If you are "bold"very security conscious"normal", you can limit "
say " configuration to requests issued from the server itself. "
say " See SREFCONF.CMD, CONFIG2.CMD, and the various *CFG.CMD files "
say " (located in " workdir ") for details."
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
a= scrclear()
signal gonotes
note3:
say cy_ye " ----- Finding Help on SRE-Filter:" normal
say ' SRE-Filter comes with numerous help documents (you can find them '
say ' in ' helpdir ')'
say ' '
say ' The following are the more important help documents: '
say ' * INTRO.DOC -- a 1 page description of SRE-Filter'
say ' * GUIDE.HTM -- the Users Guide ' bold ' -- A good place to start ' normal
say ' * SREFILTR.HTM -- the SRE-Filter manual'
say ' * SREFILTR.FAQ -- some frequently asked questions '
say " * INITFILT.DOC -- a detailed description of SRE-FILTER's initialization"
say ' parameters, with possible choices described for each. '
say ' * SREFQUIK.DOC -- a discussion of SREFQUIK -- a potentially faster variant '
say ' of SRE-Filter (requires additional configuration) '
say ' * SUMMARY.HTM -- a summary of SRE-FILTER '
say ' * CHANGES.DOC -- history of changes '
say ' * OUTLINE.HTM -- a technical outline of how SRE-Filter processes a request'
say ' * HELPLIST.HTM -- a list of the SRE-Filter help documents. '
say ' '
say " Hint: the users guide is a good place to start (there's a link to it"
say ' on the SRE-Filter sample home page) '
say ' '
say " For tough problems, you can contact DANIELH@ECON.AG.GOV "
say " "
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
a= scrclear()
signal gonotes
note4:
say cy_ye " ----- A Note on Ports:" normal
say ' If you can not use port 80, all you need to do is '
say ' change all the *.80 files (to *.new_port_number) -- see the '
say ' documentation for details '
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
a= scrclear()
signal gonotes
note5:
say cy_ye " ----- A Note on SRE-Filter add-ons:" normal
say ' SRE-Filter has a number of add-ons avaiable. You can download them '
say ' from the http://rpbbcam.econ.ag.gov/srefilter site. '
say ' For examle, you may be interested in: '
say ' 'bold'SRCHINDX:'normal' A directory-indexer/search-engine '
say ' 'bold'FORUM:'normal' A "news-group and list-server" discussion-group package '
say ' 'bold'BBS:'normal' A full featured "web based bulletin board system" '
say ' 'bold'GETAFILE:'normal' A directory displayer, with user-settable display features'
say ' 'bold'CALC:'normal' A character-mode scientific calculator with a web interface '
say ' 'bold'SREFPRC1:'normal' The source code for the SRE-Filter macrospace routines '
say ' '
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
a= scrclear()
signal gonotes
/* */
note6: nop
say cy_ye " ----- Notes for Upgraders:" normal
say " The major changes, from version 1.2g, are: "
say " 1) The configurator has been overhauled. You can now view & modify "
say " SRE-Filter's more important options using "bold"well-documented"normal" option- "
say " specific forms (see CONFIG0.HTM for details)"
say " You can now change the background colors used by the configurator."
say " 2) "reverse"Partially compiled versions"normal" of HTML documents (that contain server "
say " side includes) can now be cached. This can greatly improve response"
say " time (see SSICACHE.HTM for details). "
say " 3) The built-in directory display facility has been re-built. It caches "
say " to improve throughput, is easier to invoke, and contains an "
say " "bold" auto-description "normal"feature (see DIR.DOC for details)."
say " 4) CGI-BIN scripts written in PERL can now be run under SRE-Filter "
say " (requires a PERL interpreter -- see PERL.DOC for details). "
say " 5) The ~ home-directory can now point to a subdirectory of each "reverse"user"normal
say " 6) Several facilities that were packaged with SRE-Filter (such as FORUM"
say " and GETAFILE) are now available as add-ons."
say " 7) We " bold"recommend"normal" adding the following lines to your ALIASES.IN file: "
say " DIR/* DIR?/* "
say " CONFIGURE /CONFIGUR.HTM "
say " 9) Support for common-log, browser-log, and referer-log audit files."
say " 10) The documentation was extensively revised and more carefully edited."
say " "
say ' You can read CHANGES.DOC for a complete list of recent changes to SRE-Filter. '
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
say " "
say " "
say cy_ye ' Scan your initialization file? ' normal
say " If you did "bold"not"normal" update the INITFILT.80 file, there may be parameters "
say " that you'll need to add (or remove) by hand. "
say " To facilitate this process, you can search for all required parameters "
say " that are missing from the "bold"currently active initialization file"normal
say " It will also find incorrect (and obsolete) parameters."
say " "
say " Note: the "bold"currently active initialization file"normal" is: " initfilt_file
say " "
ok=yesno(" Would you like to view these differences?")
if ok=1 then do
a=fileread('initfilt.a80',newl,,'E')
if newl.0=0 then do
say "ERROR: Default INITFILT.80 file not found "
exit
end
n1=0
do nn=1 to newl.0
aline=strip(newl.nn)
if aline=' ' | abbrev(aline,';')=1 then iterate
n1=n1+1
parse var aline atmp '=' news.n1.!stuff
parse upper var atmp news.n1 '.' . ; news.n1=strip(news.n1)
end /* do */
news.0=n1
do forever
aa=initfilt_file
if aa<>' ' then aa=stream(aa,'c','query exists')
if aa<>' ' then leave
say bold 'Could not find the old INITFILT.80 file ('initfilt_file')' normal
say " Please enter it's (fully qualified) name: "
parse pull initfilt_file
end
a=fileread(initfilt_file,oldl,,'E')
n2=0
do nn=1 to oldl.0
aline=strip(oldl.nn)
if aline=' ' | abbrev(aline,';')=1 then iterate
n2=n2+1
parse var aline atmp '=' olds.n2.!stuff
parse upper var atmp olds.n2 '.' . ;olds.n2=strip(olds.n2)
end /* do */
olds.0=n2
Say " Looking for required parameters: "
do iu=1 to news.0
lookfor=strip(news.iu)
okay=0
do iu2=1 to olds.0
if olds.iu2=lookfor then do
iterate iu
end
end /* do */
/* if here, could not find */
parse var news.iu.!stuff goob '/*' .
thefh=replacestrg(goob,'messageboxdir',mboxdir,'ALL')
thefh=replacestrg(thefh,'mailboxdir',mailboxdir,'ALL')
thefh=replacestrg(thefh,'workingdatadir',sdatadir,'ALL')
thefh=replacestrg(thefh,'temporarydir',tempdir,'ALL')
thefh=replacestrg(thefh,'tempdatadir',tempdatadir,'ALL')
thefh=replacestrg(thefh,'uploaddir',upload_dir,'ALL')
thefh=replacestrg(thefh,'cgibindirectory',cgibin_dir,'ALL')
thefh=replacestrg(thefh,'aautoname',aautoname,'ALL')
thefh =replacestrg(thefh,'adefault',adefault,'ALL')
thefh=replacestrg(thefh,'assishtml',assi,'ALL')
thefh=replacestrg(thefh,'ahomename',ahomename,'ALL')
thefh=replacestrg(thefh,'arealm',arealm,'ALL')
thefh=replacestrg(thefh,'awebmaster',awebmaster,'ALL')
thefh=replacestrg(thefh,'assicache',assicache,'ALL')
thefh=replacestrg(thefh,'ahomedir',ahomedir,'ALL')
goob=replacestrg(thefh,'configuredir',config_dir,'ALL')
say ' Could not find ' lookfor '(recommended value= 'goob
end /* do */
call charout, cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
say " "
say " ------------- "
Say " Looking for incorrect and obsolete parameters "
do iu=1 to olds.0
lookfor=strip(olds.iu)
okay=0
do iu2=1 to news.0
if news.iu2=lookfor then do
iterate iu
end
end /* do */
/* if here, could not find */
parse var olds.iu.!stuff goob '/*' .
say ' Unused variable: ' lookfor '= ' goob
end /* do */
say " ------------- "
say " "
say " Hint: open up a text editor in another OS/2 window, and edit "
say initfilt_file " (while keeping this INSTALL window open). Make the "
say " changes, and then reselect the " reverse " notes and hints for upgraders " normal " option "
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
say " "
end
a= scrclear()
signal gonotes
/* */
note7: nop
say cy_ye " ----- Cleaning up and Removing SRE-Filter:" normal
say " After you have finished installing SRE-Filter, you can delete the contents"
say " of the temporary directory (" directory() "). "
say bold " *** "normal" You may be told that "bold"a process is locked .."normal
say " This refers to the DLL's used in the install process. At your convenience, "
say " you should reboot, and then delete, to complete this cleanup process "
say " (sorry, but I don't want to bother using OS/2 locked files facility)"
say " "
say " To remove SRE-Filter, just delete the contents of:"
say " " bold "*" normal " the GoServe working directory:" reverse workdir normal
say " before you do this, you may first want to back up the GOSERVE.* "
say " (and MAKEICON.CMD) files in the " reverse workdir normal
say " and you may want to clean up the:"
say " " bold "*" normal " GoServe data directory:" reverse datadir normal
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
say " "
a= scrclear()
signal gonotes
note8: nop
say cy_ye " ----- SRE-Filter Status Information" normal
say " If you want to keep an eye on what's happening on your web-server "
say " we recommend obtaining the PMPRINTF facility. You can download it from:"
say " http://www2.hursley.ibm.com/goserve/pmprtf.zip"
say " PMPRINTF will open a window within which status information will be shown, "
say " with optional save-to-file features."
say " "
say " We especially recommend the use of PMPRINTF if you intend to "
say " monkey with the innards of SRE-Filter, or if you take a crack at writing "
say " your own add-ons -- it's really the only way to find out where the bugs are! "
say " "
say " You can also set SRE-Filter's VERBOSE variable to set the amount of "
say " information SRE-Filter displays (0 means very little, 4 means too much)."
say " "
say " You can also use GOSERVE's AUDIT facility to record information (see "
say " GOSERVE.DOC for details)."
say " "
call charout , cy_ye ' (hit any key to continue) ' normal
foo=sysgetkey("noecho")
say " "
a= scrclear()
signal gonotes
exit
/********/
/* copy files to backup directory */
dobackup:
do mm=1 to words(in_workdir)
a1=strip(word(in_workdir,mm))
cto=backup_dir||'\'||a1
cfrom=workdir||'\'||a1
if stream(cfrom,'c','query exists')<>"" then do
call lineout,' Archiving ' cfrom ' ... '
'COPY 'cfrom ' ' cto ' > nul '
end /* Do */
end /* do */
do mm=1 to words(in_sdatadir)
a1=strip(word(in_sdatadir,mm))
cto=backup_dir||'\'||a1
cfrom=sdatadir||'\'||a1
if stream(cfrom,'c','query exists')<>"" then do
call lineout,' Archiving ' cfrom ' ... '
'COPY 'cfrom ' ' cto ' > nul '
end
end /* do */
do mm=1 to words(in_mboxdir)
a1=strip(word(in_mboxdir,mm))
cto=backup_dir||'\'||a1
cfrom=mboxdir||'\'||a1
if stream(cfrom,'c','query exists')<>"" then do
call lineout,' Archiving ' cfrom ' ... '
'COPY 'cfrom ' ' cto ' >nul'
end /* Do */
end
do mm=1 to words(in_datadir)
a1=strip(word(in_datadir,mm))
cto=backup_dir||'\'||a1
cfrom=datadir||'\'||a1
if stream(cfrom,'c','query exists')<>"" then do
call lineout,' Copying ' cfrom ' ... '
'COPY 'cfrom ' ' cto ' > nul '
end
end /* do */
return 0
/*****************/
/* Add an entry to the users.in file */
add_user:procedure expose ipaddr expose reverse bold normal re_wh cy_ye aesc
parse arg sdatadir
say " "
say bold " Add a SUPERUSER to the UserName database " normal
say " "
say " To facilitate remote configuration, we recommend that you add a "
say " user, with SUPERUSER privileges, to the SRE-Filter UserName database."
ok=yesno(' Would you like add a SUPERUSER ')
say " "
if ok=0 then do
say ' Note: To run the SRE-Filter configurator, you will need to use a '
say ' browser on the computer with the OWNERS (' ipaddr ")IP address."
return 0
end
bugs: nop
call charout, bold " Enter a username: " normal
uname=stringin(,23," ",80)
say " "
call charout, bold " Enter a password: " normal
pwd=stringin(,23," ",80)
say " "
if uname="" | pwd="" then do
say " missing username or password: please reenter "
signal bugs
end /* Do */
/* read users.in, append uname pwd , write it*/
afile=strip(sdatadir,'t','\')||'\USERS.IN'
foo=fileread(afile,inl,,'E')
oof=uname' 'pwd' SUPERUSER '
ii=inl.0+1
inl.ii=oof
inl.0=ii
foo=filewrite(afile,inl,'R')
if foo=0 then do
say " Error: could not modify usernames database file: " afile
end
else do
say " If the configurator asks for a username & password, you can use"
say bold uname normal " for the username, and " bold pwd normal " for the password "
end
return 1
/* ----------------------------------------------------------------------- */
/* HOST -- return the result of a HOST command (a ping ) */
/* ----------------------------------------------------------------------- */
/* This need not be in the main filter program */
/* It returns the GoServe command to send back the result */
host: procedure
parse arg eek
do queued(); pull .; end /* flush */
address cmd '@host' eek '| rxqueue' /* execute the command */
parse pull hostresult /* get result */
return hostresult
/*
crlf='0d0a'x
return 'STRING host' arg(1)':'crlf crlf''hostresult
*/
/* -------------------- */
/* get a yes or no , return 1 if yes */
yesno0:procedure expose normal reverse bold
parse arg fooa , allopt
ayn=' '||bold||'Y'||normal||'es\'||bold||'N'||normal||'o'
if allopt=1 then
ayn=ayn||'\'||bold||'A'||normal||'ll'
do forever
foo1=normal||reverse||fooa||normal||ayn
call charout, foo1 normal ':'
pull anans
if abbrev(anans,'Y')=1 then return 1
if abbrev(anans,'N')=1 then return 0
if allopt=1 & abbrev(anans,'A')=1 then return 2
end
/* -------------------- */
/* get a yes or no , return 1 if yes */
yesno:procedure expose normal reverse bold
parse arg fooa , allopt,altans
if altans<>" " & words(altans)>1 then do
w1=strip(word(altans,1))
w2=strip(word(altans,2))
a1=left(w1,1) ; a2=left(w2,1)
a1a=substr(w1,2) ; a2a=substr(w2,2)
end
else do
a1='Y' ; a1a='es'
a2='N' ; a2a='o'
end /* Do */
ayn=' '||bold||a1||normal||a1a||'\'||bold||a2||normal||a2a
if allopt=1 then ayn=ayn||'\'||bold||'A'||normal||'ll'
do forever
foo1=normal||reverse||fooa||normal||ayn
call charout, foo1 normal ':'
pull anans
if abbrev(anans,a1)=1 then return 1
if abbrev(anans,a2)=1 then return 0
if allopt=1 & abbrev(anans,'A')=1 then return 2
end
/* ------------------------ */
/* ask for directory name,use defname2 as default */
/* give user opportunity to create it */
get_dir:procedure expose normal reverse bold
/* procedure expose reverse normal bold */
parse arg defname2 , mustsub
defname0=defname2
n2:
call charout , reverse ' <ENTER>=' defname2 normal ' ?'
pull godir
if godir=" " then godir=defname2
if godir="n.a." then signal n2
if mustsub<>"" then do /* check 'must be subdirectory' option */
if abbrev(godir,mustsub)=0 then do
say " This directory MUST be under the " mustsub " directory! "
say " .. please re enter ! "
signal n2
end
end
godir=strip(godir,'t','\')
gdname=godir||"\*.*"
isme=directory()
isnew=directory(godir)
if isnew="" then do
say " Could not find " godir
if yesno(" Would you like to create it")=1 then do
oo=sysmkdir(godir)
if oo=0 then
say " Directory created: " godir
else do
say " Could not create " godir "(error = " oo
if godir=defname2 then defname2= "n.a."
signal n2
end
end
else do
say " please reenter directory name ... "
if godir=defname2 then defname2= "n.a."
signal n2
end
end /* Do */
isme=directory(isme)
return godir
/* ------------- */
/* ----------------------------------------------------------------------- */
/* REPLACESTRG: In string astring, find first occurence substring target and
. replace it with substring putme
. if no target, return unchanged astring
. if no putme, then remove target
. if type=backward, then find/change LAST occurence
. if type=all, find/change all occurences
. if exactmatch=yes, then do not capitalize during search (exact match only */
/* ----------------------------------------------------------------------- */
replacestrg: procedure
exactmatch=0
backward=0 ; doall=0
parse arg astring , target , putme , type , exactmatch
type = translate(type)
if type="BACKWARD" then backward="YES"
if type="ALL" then doall="YES"
iat=1
joelen=length(target)
joelen2=length(putme)
doagain: /* here if doall=yes */
if exactmatch="YES" then do
if backward="YES" then
joe= lastpos(target,astring)
else
joe= pos(target,astring,iat)
end
else do
if backward="YES" then
joe= lastpos(translate(target),translate(astring))
else
joe= pos(translate(target),translate(astring),iat)
end
if joe=0 then
return astring
astring=delstr(astring,joe,joelen)
if putme<>' ' then
astring=insert(putme,astring,joe-1)
if doall="YES" then do
iat=joe+joelen2
signal doagain
end
/* else, all done */
return astring
/* ----------------------------------------------------------------------- */
/* GRAB_FILE read in a file, but first check to see if openable, and if
. openable, open and read it.
. Returns with the file, or with 0 if file not obtainable.
. Note that file is closed before returning
. in,
. usage: afile_string=grab_file(the_file,seconds_to_try_for)
*/
/* ----------------------------------------------------------------------- */
grab_file: procedure
parse arg afile
ause=stream(afile,'c','open read')
if ause<>"READY:" then
return 0
goo=charin(afile,1,chars(afile))
ause=stream(afile,'c','close')
/* get rid of ending ctl-z */
if c2d(right(goo,1))=26 then
goo=left(goo,length(goo)-1)
return goo
/*******************************************/
/* check for existence of file, then ask user to copy or not */
/* note that for X.* type copies, it only checks once
(not for each file, but just for any one of them */
/********************************************/
check_copy: procedure expose copyall reverse bold normal
parse arg file1, dest1 , amess , noask
dest2=strip(dest1,'t','\')||'\'
filename=dest2||file1
if copyall=1 then signal doit3
aa=sysfiletree(filename,isit,'F')
ok=1
if aa<>0 then do
say " Warning: error when looking for pre-existing copy of: " filename
ok=yesno(" Do you want to copy this file (or files) anyways? ")
if ok=1 & amess<>"" then
ok=yesno(amess)
end
if noask=1 then signal doit3
if isit.0>0 then do
if pos('*',file1)=0 then do
say " "
say " A file exists with the name: " filename
ok=yesno(" Do you want to overwrite this file? ",1)
if ok=1 & amess<>"" then
ok=yesno(amess)
end
else do
say " "
say " There is at least one file that matches: " filename
say " (this match may " bold " not " normal " be one of the files that will be copied!) "
ok=yesno(" Do you want to copy these files? ",1)
if ok=1 & amess<>"" then
ok=yesno(amess)
end /* Do */
end
if ok=2 then do
say " "
say "SRE-FILTER will overwrite all files "
copyall=yesno(" Are you sure you want to do this?")
if copyall=0 then
ok=yesno(" Do you want to overwrite the current file (or files)? ")
end
if ok=0 then return 0
doit3: /* jump here if copyall is on, or noask=1 */
'COPY ' file1 dest1 ' > NUL '
return 1
/* ------------------------------------------------------------------ */
/* function: Check if ANSI is activated */
/* */
/* call: CheckAnsi */
/* */
/* where: - */
/* */
/* returns: 1 - ANSI support detected */
/* 0 - no ANSI support available */
/* -1 - error detecting ansi */
/* */
/* note: Tested with the German and the US version of OS/2 3.0 */
/* */
/* */
CheckAnsi: PROCEDURE
thisRC = -1
trace off
/* install a local error handler */
SIGNAL ON ERROR Name InitAnsiEnd
"@ANSI 2>NUL | rxqueue 2>NUL"
thisRC = 0
do while queued() <> 0
queueLine = lineIN( "QUEUE:" )
if pos( " on.", queueLine ) <> 0 | , /* USA */
pos( " (ON).", queueLine ) <> 0 then /* GER */
thisRC = 1
end /* do while queued() <> 0 */
InitAnsiEnd:
signal off error
RETURN thisRC
/* get the hostname (aa.bb.cc) for this machine */
get_hostname: procedure
do queued(); pull .; end /* flush */
address cmd '@hostname | rxqueue'
parse pull hostname
return hostname
set_params:procedure expose adefault aautoname awebmaster arealm ahomename assi ,
CY_YE BOLD NORMAL REVERSE thishost assicache ahomedir
/* Set some "common parameters" */
enterparams:
say " If you like, you can customize a few of the initialization parameters."
say " If you choose not to, default values will be used "
adefault='INDEX.HTM'
aautoname=' *.HTML *.HTM INDEX.HTML INDEX.HTM !CREATE '
awebmaster='The Webmaster '
parse var thishost arealm '.' .
assi=0
ahomename='Our WWW site '
ahomedir='homedir/'
assicache='1'
ok=yesno('Would you like to customize a few "initialization parameters"')
if ok=1 then do
say ' You will be asked to enter the values of several "initialization" parameters.'
say ' You can edit the default values by using arrow keys, etc. '
say ' '
say bold "DEFAULT" normal " should be the HTML document to use as your site's Home Page. "
say " The " bold "DEFAULT" normal "is used when requests to the root directory "
say " of your server are recieved (that is, empty request selectors, "
say " as would be generated by a URL of http://xxx.yy.zzz/ )"
thedef="INDEX.HTM"
say reverse "DEFAULT? " normal
adefault=stringin(,2,thedef,40)
say " "
say " "
say bold "AUTO_NAME" normal " should contain a list of HTML documents that may be used as"
say " the default document for a directory. These are used when requests to the "
say " root of a" bold "directory" normal " are recieved. "
say " For example: a URL of " bold " http://xxx.yy.zzz/books/classics/ " normal
say " would generate a request selector of: " bold "books/classics' " normal
say " -- and SRE-Filter would use AUTO_NAME to determine which file "
say " (in the books/classics/ subdirectory) to use. "
thedef="INDEX.HTM INDEX.HTML "
say reverse "AUTO_NAME? " normal
fooauto=stringin(,2,thedef,70)
aautoname=fooauto
say " "
say " Before trying these files, SRE-Filter can look for dirname.HTML and "
say " dirname.HTM; where " bold "dirname" normal 'is the "deepest" part of the directory name '
say " For example, using the above example ( " bold " books/classics/" normal
say " SRE-Filter would first look for " bold "CLASSICS.HTML" normal "and" bold "CLASSICS.HTM" normal
if length(fooauto) < 30 then do
say " ("fooauto " would be tried only if CLASSICS.HTML and "
say " and CLASSICS.HTM did not exist)"
end
else do
say " ("fooauto
say " would be tried only if CLASSICS.HTML and CLASSICS.HTM did not exist)"
end /* Do */
isdname=yesno(' Should SRE-Filter attempt this "directory name matching"?')
if isdname=1 then aautoname=" *.HTML *.HTM "||aautoname
say " Lastly, if none of the above work, SRE-Filter can display a list "
say " of files and subdirectories. "
isflist=yesno(' When all else fails, should SRE-Filter display a file listing?')
if isflist=1 then aautoname=aautoname||' !CREATE '
if isflist=1 then
say " Note: by default, this file listing will NOT contain descriptions. "
say ' '
say bold " WEBMASTER " normal " should contain the name (and address) of a contact person. "
thedef=' <a href="mailto:webmaster@'thishost'">The WebMaster</a> '
say reverse " WEBMASTER? " normal
awebmaster=stringin(,2,thedef,80)
say " ";say " "
say bold " THE_REALM " normal "is used as your site's default " bold " realm. " normal
say " (the" bold "Realm" normal "is displayed when clients are asked to "
say " enter a username and password). "
parse var thishost thedef '.'
say reverse " THE_REALM? " normal
arealm=stringin(,2,thedef,40)
say " "
say " "
say bold " SSI_SHTML_ONLY " normal "is used to limit " bold " server side includes"
say normal " to files that have " bold ' .SHTML ' normal "(or " bold " .SHT" normal ") extensions. "
say " If SSI_SHTML_ONLY is not turned on, then all HTML document will "
say " be checked for " bold "server side includes. " normal
assi=yesno(' Only check .SHTML and .SHT files for server side includes? ')
assi=word('NO YES',assi+1)
say " "
say bold " SSI_CACHE_ON " normal "is used to enable the "bold"SSI-cache."normal
say "The "bold"SSI-cache"normal" is used to store pre-compiled versions of HTML documents "
say "that contain server side includes (SSIs). When appropriate, "
say "SRE-Filter will return these documents (perhaps with further modifications)."
say " The use of the " bold"SSI-CACHE"normal" can significantly improve "
say " response time. However, on very dynamic sites, there is a small "
say " chance that out-of-date document will occasionally be returned. "
assicache=yesno(' Enable the SSI-CACHE (YES), or disable it (NO)? ')
assicache=word('NO YES',assicache+1)
say " " ; say " "
say bold " HOME_NAME " normal " should contain the colloquial name of your site."
say bold " HOME_NAME " normal " is used in certain descriptive responses, "
say " such as when a client asks for a non-existent file. "
thedef="Our WWW site "
say reverse " HOME_NAME? " normal
ahomename=stringin(,2,thedef,70)
say " " ; say " "
say bold " HOME_DIR " normal " should contain which subdirectory (of your Goserve "
say " directory) to use when resolving requests containing a ~ character. "
say ' For example, if ' bold ' HOME_DIR=students/personal/ ' normal
say ' then a request selector of ~gerry.htm' normal 'would be equivalent '
say ' to ' bold 'students/personal/gerry.htm ' normal
thedef="HOMEDIR/ "
say reverse " HOME_DIR " normal
ahomedir=stringin(,2,thedef,40)
say " "
say " "
say cy_ye " You have chosen the following settings: " normal
say " " reverse "DEFAULT:" normal adefault
say " " reverse "AUTO_NAME:" normal fooauto
select
when isdname=1 & isflist=1 then
say " (with dirname.HTML checking, and file-listing if all else fails)"
when isdname=1 then
say " (with dirname.HTML checking)"
when isflist=1 then
say " (with file-listing if none of these exists)"
otherwise
nop
end
say " " reverse "HOME_DIR:" normal ahomedir
say " " reverse "WEBMASTER:" normal awebmaster
say " " reverse "THE_REALM:" normal arealm
say " " reverse "HOME_NAME:" normal ahomename
say " " reverse "SSI_SHTML_ONLY:" normal assi
say " " reverse "SSI_CACHE_ON:" normal assicache
say " "
foo=yesno(" Are these okay? ")
if foo=0 then signal enterparams
end
return 0